﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure.ServiceRuntime;

namespace BasicClasses
{
    public class PacienteDataSource
    {
        private static PacienteContext context = new PacienteContext();
        private static string tableName = RoleEnvironment.GetConfigurationSettingValue("PacienteTable");

        public static IEnumerable<Paciente> SelectAll()
        {
            return context.Pacientes;
        }

        public static void Add(Paciente paciente, string partitionKey) //partitionKey == Pais
        {
            paciente.PartitionKey = partitionKey;
            paciente.RowKey = Guid.NewGuid().ToString();
            context.AddObject(tableName, paciente);
            context.SaveChanges();
        }
    }
}
